package com.yule.system.home;

import com.yule.system.dao.SystemUserDao;
import com.yule.system.model.SystemUser;
import com.yule.system.model.SystemUserExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemUserHome {

    @Autowired
    private SystemUserDao systemUserDao;

    public List<SystemUser> findList(SystemUserExample systemUserExample){
        return systemUserDao.selectByExample(systemUserExample);
    }

    public int save(SystemUser model){
        int id = systemUserDao.insertSelective(model);
        return id;
    }

    public SystemUser findOne(int id){
        SystemUser systemUser = systemUserDao.selectByPrimaryKey(id);
        return systemUser;
    }

    public int update(SystemUser model){
        return systemUserDao.updateByPrimaryKeySelective(model);
    }

    public int delete(int id){
        return systemUserDao.deleteByPrimaryKey(id);
    }
}
